package com.slz3.business.module.orderManagement.ordOrderLogistics.domain;

import com.slz3.business.frame.functions.Add;
import com.slz3.business.frame.functions.Modify;
import com.slz3.business.module.orderManagement.ordOrder.domain.OrdOrder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.UUID;

@Entity
@Table(schema = "order_management", name = "ord_order_logistics")
@Data
@EqualsAndHashCode(callSuper = true)
public class OrdOrderLogistics extends OrdOrderLogisticsEntity implements Serializable {

    private static final long serialVersionUID = 3928173855627287110L;

    /**
     * 订单uuid
     */
    @NotNull(message = "orderUuid 必须非空!", groups = {Add.class, Modify.class})
    private UUID orderUuid;

    /**
     * 物流单号
     */
    @NotNull(message = "logisticsNo 必须非空!", groups = {Add.class, Modify.class})
    @Length(min = 1, max = 80, message = "ser2 必须非空并且不超过 80 个字符!", groups = {Add.class, Modify.class})
    @Pattern(regexp = "^[0-9]{12}$",message = "物流单号格式不正确",groups = {Add.class,Modify.class})
    private String logisticsNo;

    /**
     * 快递公司
     */
    @NotNull(message = "logisticsCompany 必须非空!", groups = {Add.class, Modify.class})
    @Length(min = 1, max = 80, message = "ser2 必须非空并且不超过 80 个字符!", groups = {Add.class, Modify.class})
    private String logisticsCompany;

    /**
     * 快递公司拼音
     */
    @NotNull(message = "logisticsCompanyPinyin 必须非空!", groups = {Add.class, Modify.class})
    @Length(min = 1, max = 80, message = "ser2 必须非空并且不超过 80 个字符!", groups = {Add.class, Modify.class})
    private String logisticsCompanyPinyin;

    @Transient
    private OrdOrder ordOrder;


}
